
import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Abahe
 */
public class Peta extends Canvas implements CommandListener {

    private BTIMidlet midlet;
    private Image imgPeta;
    private Command cmdKembali;

    public Peta(BTIMidlet midlet) {
        cmdKembali = new Command("Kembali", Command.BACK, 1);
        addCommand(cmdKembali);
        setCommandListener(this);

        this.midlet = midlet;
        try {
            imgPeta = Image.createImage("/peta_bandung.jpg");
        } catch (IOException ex) {
        }
    }

    protected void paint(Graphics g) {
        g.setColor(0xffffff);
        g.drawImage(imgPeta, 0, 0, Graphics.TOP | Graphics.LEFT);
    }

    public void commandAction(Command c, Displayable d) {
        if (c == cmdKembali) {
            if(BTIMidlet.BEFORE == 1){
                midlet.showObjekWisata(BTIMidlet.INDEKS);
            }else if(BTIMidlet.BEFORE == 2){
                midlet.showTempatKuliner(BTIMidlet.INDEKS);
            }else if(BTIMidlet.BEFORE == 3){
                midlet.showHotel(BTIMidlet.INDEKS);
            }else if(BTIMidlet.BEFORE == 4){
                midlet.backToMenuCanvas();
            }
            
        }
    }
}
